<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:replace="fragment/Headfragment::Headfragment">


</head>
<body>
<!-- navbar-->
<header th:replace="fragment/PageHeadfragment::PageHeadfragment"></header>
<div class="d-flex align-items-stretch">
    <div th:replace="fragment/Navigationfragment::Navigationfragment"></div>


    <!--start-->
    <section class="container-fluid px-xl-5">
        <div>
            <!--文本输入-->
            <form action="/usercreatetable/query" method="post">
                <br>
                <textarea class="form-control border-0 shadow form-control-lg" name="sql" type="text" rows="10"
                          cols="100"></textarea>
                <br>
                <div style="text-align: center">
                    <button type="submit" class="btn btn-primary">执行</button>
                </div>
            </form>

            <!--上传文件-->
            <form action="/usercreatetable/updateFile" method="post" enctype="multipart/form-data">
                <table>
                    <tr>
                        <td><input type="file" name="file" multiple/></td>
                    </tr>
                    <tr>
                        <td><button type="submit" class="btn btn-primary">执行文件</button></td>
                    </tr>
                </table>
            </form>

            <div>
                <!--显示修改成功-->
                <p>
                <h3>
                    <a style="color: #ed1d2b" th:text="${session.modifyStr}"
                       th:if="${not #strings.isEmpty(session.modifyStr)}"></a>
                </h3>
                </p>
                <!--程序报错，显示查询失败-->
                <p>
                <h3>
                    <a style="color: #ed1d2b" th:text="${session.failStr}"
                       th:if="${not #strings.isEmpty(session.failStr)}"></a>
                </h3>
                </p>
                <!--提示err-->
                <p>
                <h5>
                    <a style="color: #ed1d2b" th:text="${session.errorPrompt}"
                       th:if="${not #strings.isEmpty(session.errorPrompt)}"></a>
                </h5>
                </p>
            </div>

            <!--查询结果显示-->
            <div class="card-body">
                <table  class="table table-striped card-text">
                    <p>
                    <h3>
                        <a th:text="${session.tableName}"></a>
                    </h3>
                    </p>
                    <thead >
                    <tr >
                        <!--遍历输出字段名-->
                        <!--<th>#</th>-->
                        <th th:each="fl,rowInfo:${session.fieldName}" >
                            <a th:text="${fl}"></a>
                        </th>
                    </tr>
                    </thead>
                    <tbody>
                    <!--遍历第一次得到每行的数据-->
                    <tr th:each="pl,rowInfo:${session.pojolist}" >
                        <!--<th scope="row">1</th>-->
                        <!--遍历第二次获取每行单个数据-->
                        <td th:each="ps:${pl}" >
                            <a th:text="${ps}"></a>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </section>
</div>

<!-- JavaScript files-->
<script src="vendor/jquery/jquery.min.js"></script>
<script src="vendor/popper.js/umd/popper.min.js"></script>
<script src="vendor/bootstrap/js/bootstrap.min.js"></script>
<script src="vendor/jquery.cookie/jquery.cookie.js"></script>
<script src="vendor/chart.js/Chart.min.js"></script>
<script src="js/js.cookie.min.js"></script>
<script src="js/charts-custom.js"></script>
<script src="js/front.js"></script>
</body>
</html>